Plotting the Softmax functions

Imports


In [18]:
import numpy as np
from skboost.milboost.softmax import *

In [20]:
%pylab inline

Data


In [24]:
x = np.linspace(0.0, 1.0, num=100)
t = np.vstack([x, 1 - x]).T
true_t = np.max(t, axis=1)

In [25]:
lse_5 = np.array(map(LogSumExponential(5.0).f, t))
lse_20 = np.array(map(LogSumExponential(20.0).f, t))
nor = np.array(map(NoisyOR().f, t))
isr = np.array(map(ISR().f, t))
gm_5 = np.array(map(GeneralizedMean(5.0).f, t))
gm_20 = np.array(map(GeneralizedMean(20.0).f, t))

In [23]:
plt.plot(x, true_t, 'k--', label='True')
plt.plot(x, lse_5, 'b', label='LSE(5)')
plt.plot(x, lse_20, 'y', label='LSE(20)')
plt.plot(x, nor, 'r', label='NOR')
plt.plot(x, isr, 'g', label='ISR')
plt.plot(x, gm_5, 'm', label='GM(5)')
plt.plot(x, gm_20, 'c', label='GM(20)')

plt.legend()
plt.xlabel('v')
plt.ylabel('g_{l}(v_{l})')

plt.show()

In [ ]: